package com.itcoon.cloud.framework.ex.errorcode;


import com.itcoon.cloud.framework.enums.CommonModule;
import com.itcoon.cloud.framework.enums.IModule;
import com.itcoon.cloud.framework.ex.exception.DefaultServiceException;

public enum CommonServiceErrorCode implements IModuleServiceErrorCode<DefaultServiceException> {

    DEFAULT_SERVICE_EXCEPTION("000", "未知异常"),

    BAD_PARAMETER("010","参数错误"),

    OPERATION_DENIED("020", "操作不被允许"),

    RESOURCE_EXISTS("001", "资源已经存在"),

    RESOURCE_MISS_OR_DELETED("002", "资源被删除或不存在")
    ;
    private final String code;
    private final String message;


    private

    CommonServiceErrorCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public IModule getModule() {
        return CommonModule.COMMON;
    }

    @Override
    public String getMessage() {
        return this.message;
    }

    @Override
    public DefaultServiceException bindException() {
        return new DefaultServiceException(this);
    }

    @Override
    public String getServiceCode() {
        return this.code;
    }
}
